package com.example.chapter4;


import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

public class FirstServlet extends HttpServlet {
    public FirstServlet(){
        super();
    }
    @Override
    public void init() throws SecurityException{
        super.destroy();
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
            SecurityException, IOException {
        response.setContentType("text/html");
        request.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
        out.println("<html>");
        out.println("<HEAD><TITLE>动态生成的HTML文档</TITLE></HEAD>");
        out.println("<BODY>");
        out.println("<table border=0 align=center>");
        out.println("<tr><td bgcolor='skybule'colspan=2>动态生成HTML文档</td></tr>");
        out.println("</table>");
        out.println("</BODY>");
        out.println("</html>");
        out.flush();
        out.close();
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        doPost(request, response);
    }
}
